/**
 *
 * @author
 *
 */
class NewBall {
    public AllBall: any[] = [];
    public radius: number = 17;
    public vx: number = 0;
    public vy: number = 0;
    public idx: number = 0;
    public nextX: number = 0;
    public nextY: number = 0;

    public lastX: number = 0;
    public lastY: number = 0;
    public name: string = "";
    public isJindong: number = -1;//-1没有进洞，0-5进入的洞口
    public moc: number = 0.9997;
    public degree: number = 0;
    constructor(_idx: number) {
        this.idx = _idx;
        this.createBall(_idx);
    }
    /**速度衰减 */
    public startRoll() {
        this.vx = this.vx * this.moc;
        this.vy = this.vy * this.moc;

        if (Math.abs(this.vx) < 0.04 && Math.abs(this.vy) < 0.04) {
            this.moc -= 0.000001;
        }

        if (Math.abs(this.vx) < 0.002 && Math.abs(this.vy) < 0.002) {
            this.vx = 0;
            this.vy = 0;
        }
    }
    private createBall(_idx: number) {
        this.AllBall[_idx] = MoveGan.getInstance().AllGroup.$children[_idx];

        // return  MoveGan.getInstance().AllGroup.$children[_idx];
    }

    public setBallPos1(_nx: number, _ny: number, _idx: number): void {
        this.AllBall[_idx].x = _nx;
        this.AllBall[_idx].y = _ny;
    }

}



